Ext.define('Jason.view.protal.yyzb.MainViewCtrl', {
    extend: 'Wys.basic.BaseCtrl',
    alias: 'controller.yypdViewCtrl',
    onTreeItemclick:function(tree, record, item, index, e, eOpts ) {
        var me = this;
            centerView = me.getView().down('#centerView');
        if(record.isLeaf()){
            centerView.removeAll();
            if(Ext.isEmpty(record.get('formSrc'))){
                EUtil.showError('['+record.get('name')+']未配置明细地址')
                return;
            }
            EUtil.RS({
                url:cfg.requestUrl + record.get('formSrc') + cfg.suffix,
                callback:function(resp){
                    if(resp.success){
                        Ext.Array.each(resp.data,function(obj){
                            var childs = [];
                            Ext.Array.each(obj.children,function(child){
                                childs.push({fieldLabel:child.text});
                            });
                            centerView.add({
                                xtype:'fieldset',
                                title: obj.text || '未配置',
                                formulaText: obj.formulaText,
                                collapsible: true,
                                defaultType: 'numberfield',
                                defaults: {anchor: '100%',labelAlign:'top'},
                                layout: obj.layout || {},
                                items: childs
                            });
                            console.log('over');
                        });
                    }
                }
            })
        }
    }
});